#!/usr/bin/python

import sys

def main():
    bit = 100
    if len(sys.argv) > 1:
        bit = int(sys.argv[1])
    #generate the list
    l = [2]
    #loop 99 times
    for i in range(1,bit):
        if (i+1) %3 == 0:
            l.append(2*(i+1)/3)
        else:
            l.append(1)
    print l
    #iterate to get the result
    n = 1
    d = 0
    for k in l[::-1]:
        d,n = n,k*n + d
        
    print sum([int(i) for i in str(n)])

if __name__ == '__main__':
    main()
    
